package com.demo.syschornized;

public class SyschornizedDemo {
    public static void main(String[] args) {


    }

}

/**
 * 饿汉式单例
 */
class lazySingleton{

    private  static  lazySingleton  instance =null;

    private lazySingleton() {

    }
    public  synchronized static  lazySingleton getInstance(){
            if(null!=instance){
                instance =new lazySingleton();
            }
            return  instance;
    }
}



